/****************************************************************************************************************************************************************
 *                                                                                                                                                              *
 *                                                                                                                                                              *
 *                                                                                                                                                              *
 *                                                                                                                                                              *
 *                      _____  ___________                   ___    ______      ______           _____     _______________________                              *
 *                      __  / / /__  /_  /_____________ _    __ |  / /__(_)________  /_____________  /_    ___    |_____/_/__  __ \                             *
 *                      _  / / /__  /_  __/_  ___/  __ `/    __ | / /__  /_  __ \_  /_  _ \_  __ \  __/    __  /| |___/_/ __  / / /                             *
 *                      / /_/ / _  / / /_ _  /   / /_/ /     __ |/ / _  / / /_/ /  / /  __/  / / / /_      _  ___ |_/_/   _  /_/ /                              *
 *                      \____/  /_/  \__/ /_/    \__,_/      _____/  /_/  \____//_/  \___//_/ /_/\__/      /_/  |_/_/     /_____/                               *
 *                                                                                                                                                              *
 *                                                                                                                                                              *
 *                                                                                                                                                              *
 *                                                                                                                                                              *
 *                                                                                                                                                              *
 *      @Project: Ultra Violent - Attack and Defend                                                                                                             *
 *                                                                                                                                                              *
 *                                                                                                                                                              *
 *      @Author: Daniel "thiaZ" Koenen                                                                                                                          *
 *          @Used content                                                                                                                                       *
 *              @sscanf Plugin, foreach, Whirlpool Plugin, YSI - Y_Less                                                                                         *
 *              @zcmd - Zeex                                                                                                                                    *
 *              @Streamer Plugin, IRC Plugin - Incognito                                                                                                        *
 *              @dini - Dracoblue                                                                                                                               *
 *              @MySQL Plugin - G-sTyLeZzZ                                                                                                                      *
 *          @Special thanks to                                                                                                                                  *
 *              @Slice                                                                                                                                          *
 *                                                                                                                                                              *
 *                                                                                                                                                              *
 *      @File: uvaad.pwn - Main File                                                                                                                            *
 *                                                                                                                                                              *
 *                                                                                                                                                              *
 *      @This file is not released under any open source licence, you are not allowed to own this file except you have the author's permission.                 *
 *                                                                                                                                                              *
 *                                                                                                                                                              *
 *      @copyright (c) Daniel "thiaZ" Koenen 2010 - 2011 - danielkoenen@t-online.de                                                                             *
 *                                                                                                                                                              *
 ****************************************************************************************************************************************************************/          
 
Hook:OnGameModeInit()
{
    loadTextDraws();
    loadObjects();
    loadVehicles();
    clearDeathMessages();
    clearVariables();
    return true;
}

stock doNothing( { Float, _ }:... )
    return;

stock nickName(playerId) {
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerId, name, MAX_PLAYER_NAME);
    return name;
}

stock ipHash(playerId) {
    new _ip[32];
    GetPlayerIp(playerId, _ip, 32);
    return adler32(_ip);
}

stock playerIP(playerId) {
    new _ip[32];
    GetPlayerIp(playerId, _ip, 32);
    return _ip;
}

stock adler32(const inputString[])
{
    new sum[2] = {1, 0};

    for(new i = 0; i < strlen(inputString); i++)
    {
        sum[0] = (sum[0] + inputString[i]) % 65521;
        sum[1] = (sum[0] + sum[1]) % 65521;
    }
    
    return (sum[1] << 16) | sum[0];
}
    
stock isValidSkin(skinid)
{
    #define MAX_BAD_SKINS 22
    new badSkins[MAX_BAD_SKINS] =
    {
        3, 4, 5, 6, 8, 42, 65, 74, 86,
        119, 149, 208, 265, 266, 267,
        268, 269, 270, 271, 272, 273, 289
    };
    
    if (skinid < 0 || skinid > 299) 
    {
        return false;
    }
    
    for(new i = 0; i < MAX_BAD_SKINS; i++)
    {
        if (skinid == badSkins[i]) 
        {
            return false;
        }
    }
    
    #undef MAX_BAD_SKINS
    return true;
}
 
stock loadVehicles()
{
    /*
    new iVehicle;
    
    iVehicle = CreateVehicle(468, -1371.77, 1641.21, 1052.19, 90.0, 0, 0, 360); // sanchez_real
    LinkVehicleToInterior(iVehicle, 14);
    
    iVehicle = CreateVehicle(468, -1371.77, 1643.21, 1052.20, 90.0, 0, 0, 360); // sanchez_real2
    LinkVehicleToInterior(iVehicle, 14);
    
    iVehicle = CreateVehicle(468, -1371.77, 1645.21, 1052.19, 90.0, 0, 0, 360); // sanchez_real3
    LinkVehicleToInterior(iVehicle, 14);
    
    iVehicle = CreateVehicle(468, -1371.77, 1647.21, 1052.19, 90.0, 0, 0, 360); // sanchez_real3
    LinkVehicleToInterior(iVehicle, 14);
    
    iVehicle = CreateVehicle(468, -1371.77, 1649.21, 1052.19, 90.0, 0, 0, 360); // sanchez_real3
    LinkVehicleToInterior(iVehicle, 14);
    
    iVehicle = CreateVehicle(468, -1371.77, 1651.21, 1052.19, 90.0, 0, 0, 360); // sanchez_real3
    LinkVehicleToInterior(iVehicle, 14);
    
    iVehicle = CreateVehicle(468, -1371.77, 1653.21, 1052.19, 90.0, 0, 0, 360); // sanchez_real3
    LinkVehicleToInterior(iVehicle, 14);
    */
    
    CreateVehicle(471, -2282.57, -1638.25, 483.03, 80.42, 0, 0, 360); // quad
    CreateVehicle(471, -2282.78, -1640.07, 482.97, 80.62, 0, 0, 360); // quad
    CreateVehicle(471, -2282.43, -1636.49, 483.10, 83.08, 0, 0, 360); // quad
    CreateVehicle(471, -2282.89, -1641.70, 482.90, 84.04, 0, 0, 360); // quad
    CreateVehicle(468, -2320.52, -1683.28, 481.89, 116.14, 0, 0, 360); // sanchez
    CreateVehicle(468, -2321.17, -1682.03, 481.97, 115.75, 0, 0, 360); // sanchez
    CreateVehicle(468, -2321.89, -1680.65, 482.06, 127.15, 0, 0, 360); // sanchez
    CreateVehicle(468, -2322.83, -1679.24, 482.16, 124.61, 0, 0, 360); // sanchez
    CreateVehicle(510, -2244.51, -1750.91, 480.21, 209.79, 0, 0, 360); // bike
    CreateVehicle(571, -2231.33, -1744.92, 480.16, 209.42, 0, 0, 360); // kart
    CreateVehicle(571, -2232.69, -1745.68, 480.16, 208.90, 0, 0, 360); // kart
    CreateVehicle(571, -2234.10, -1746.29, 480.16, 211.29, 0, 0, 360); // kart
    return true;
}   

stock clearVariables()
{
    teamData [TEAM_HOME][bAttacking] = false;
    teamData [TEAM_AWAY][bAttacking] = true;
    
    gameData [iCurBase] = -1;
    gameData[iUptime] = GetTickCount();
    return true;
}

stock loadObjects() 
{
    // Duel map
    CreateDynamicObject(9949, -1389.67578125, 951.88769531, 1109.54187012, 0.00000000, 0.00000000, 89.99450684, -1, -1, -1, 400.0); //Object number 0
    CreateDynamicObject(9949, -1404.96289062, 1034.47167969, 1109.54187012, 0.00000000, 0.00000000, 270.00000000, -1, -1, -1, 400.0); //Object number 1
    CreateDynamicObject(9949, -1335.89257812, 1001.71582031, 1109.53527832, 0.00000000, 0.00000000, 179.32434082, -1, -1, -1, 400.0); //Object number 2
    CreateDynamicObject(9949, -1459.08203125, 993.99414062, 1109.53527832, 0.00000000, 0.00000000, 0.67016602, -1, -1, -1, 400.0); //Object number 3
    CreateDynamicObject(11083, -1386.25585938, 990.66992188, 1108.09594727, 0.00000000, 179.99450684, 90.64819336, -1, -1, -1, 400.0); //Object number 4
    CreateDynamicObject(11083, -1383.68444824, 970.49621582, 1135.49951172, 0.00000000, 90.00000000, 89.99450684, -1, -1, -1, 400.0); //Object number 5
    CreateDynamicObject(11083, -1398.64208984, 1016.09362793, 1132.40710449, 0.00000000, 90.00000000, 270.00000000, -1, -1, -1, 400.0); //Object number 6
    CreateDynamicObject(11083, -1355.25708008, 926.81665039, 1127.47399902, 0.00000000, 90.00000000, 179.32434082, -1, -1, -1, 400.0); //Object number 7
    CreateDynamicObject(11083, -1440.71240234, 993.22534180, 1108.53125000, 0.00000000, 90.00000000, 0.66467285, -1, -1, -1, 400.0); //Object number 8
    CreateDynamicObject(11083, -1422.69628906, 989.60742188, 1114.19726562, 0.00000000, 180.00000000, 90.64819336, -1, -1, -1, 400.0); //Object number 9
    CreateDynamicObject(8419, -1397.50244141, 992.82183838, 1085.91784668, 0.00000000, 0.00000000, 270.00000000, -1, -1, -1, 400.0); //Object number 10

    // Map fixes
    CreateDynamicObject(980, 261.98876953, 1821.17456055, 10.87645912, 0.00000000, 0.00000000, 0.00000000, -1, -1, -1, 400.0);
    CreateDynamicObject(980, 2140.62475586, 1621.00305176, 1002.80371094, 0.00000000, 0.00000000, 0.00000000, -1, -1, -1, 400.0);
    CreateDynamicObject(8150, 2441.86450195, 2164.91821289, 11.55875015, 0.00000000, 0.00000000, 180.00000000, -1, -1, -1, 400.0);
    CreateDynamicObject(980, 2508.35180664, 1144.64038086, 18.47830582, 0.00000000, 0.00000000, 0.00000000, -1, -1, -1, 400.0);
    CreateDynamicObject(980, 2517.37426758, 1150.24096680, 17.66824341, 0.00000000, 0.00000000, 0.00000000, -1, -1, -1, 400.0);
    
    // Arena 0
    CreateDynamicObject(8357, -296.00915527, 1229.07788086, 24.43617249, 0.00000000, 90.00000000, 272.66052246, ARENA_WORLD, -1, -1, 400.0); //Object number 0
    CreateDynamicObject(8357, -386.73159790, 1118.73205566, 24.43326569, 0.00000000, 90.00000000, 0.00000000, ARENA_WORLD, -1, -1, 400.0); //Object number 1
    CreateDynamicObject(8357, -296.46990967, 960.85070801, 24.50866699, 0.00000000, 90.00000000, 59.54968262, ARENA_WORLD, -1, -1, 400.0); //Object number 2
    CreateDynamicObject(8357, -195.60961914, 964.57794189, 24.59045410, 0.00000000, 90.00000000, 90.00000000, ARENA_WORLD, -1, -1, 400.0); //Object number 3
    CreateDynamicObject(8357, -181.23674011, 971.07928467, 24.54910278, 0.00000000, 90.00000000, 108.54003906, ARENA_WORLD, -1, -1, 400.0); //Object number 4
    CreateDynamicObject(8357, 26.00351334, 1004.80938721, 24.63074493, 0.00000000, 90.00000000, 89.99996948, ARENA_WORLD, -1, -1, 400.0); //Object number 5
    CreateDynamicObject(8357, 47.63938904, 1079.53295898, 24.67585754, 0.00000000, 90.00000000, 135.65472412, ARENA_WORLD, -1, -1, 400.0); //Object number 6
    CreateDynamicObject(8357, 114.69129181, 1190.05786133, 24.63455200, 0.00000000, 90.00000000, 180.00000000, ARENA_WORLD, -1, -1, 400.0); //Object number 7
    CreateDynamicObject(8357, 69.05609131, 1256.16186523, 24.64001465, 0.00000000, 90.00000000, 219.69421387, ARENA_WORLD, -1, -1, 400.0); //Object number 8
    CreateDynamicObject(8357, 30.79683685, 1259.48583984, 24.50160217, 0.00000000, 90.00000000, 243.51269531, ARENA_WORLD, -1, -1, 400.0); //Object number 9
    CreateDynamicObject(8357, -40.39053345, 1248.90563965, 24.50527191, 0.00000000, 90.00000000, 267.33178711, ARENA_WORLD, -1, -1, 400.0); //Object number 10
    CreateDynamicObject(8357, -87.20143127, 1254.61059570, 24.49802017, 0.00000000, 90.00000000, 281.22521973, ARENA_WORLD, -1, -1, 400.0); //Object number 11
    return true;
}

stock loadTextDraws() 
{   
    new szDrawString[256];
    
    format(szDrawString, 256, "%s~h~www~w~.%s~h~uvhclan~w~.%s~h~com", DEF_TAG, ATT_TAG, DEF_TAG);
    textDraw[ModeName] = TextDrawCreate(537.000000, 1.000000, szDrawString);
    TextDrawBackgroundColor(textDraw[ModeName], 255);
    TextDrawFont(textDraw[ModeName], 0);
    TextDrawLetterSize(textDraw[ModeName], 0.500000, 1.000000);
    TextDrawColor(textDraw[ModeName], -1);
    TextDrawSetOutline(textDraw[ModeName], 1);
    TextDrawSetProportional(textDraw[ModeName], 1);
    
    textDraw[StripeUp] = TextDrawCreate(0.0,0.0,"~n~~n~~n~~n~~n~~n~~n~~n~");
    TextDrawFont(textDraw[StripeUp],1);
    TextDrawLetterSize(textDraw[StripeUp],1,1);
    TextDrawColor(textDraw[StripeUp],0x000000FF);
    TextDrawSetShadow(textDraw[StripeUp],1);
    TextDrawSetOutline(textDraw[StripeUp],50);
    TextDrawBackgroundColor(textDraw[StripeUp],0x000000FF);
    TextDrawUseBox(textDraw[StripeUp],1);
    TextDrawBoxColor(textDraw[StripeUp],0x000000FF);

    textDraw[StripeDown] = TextDrawCreate(0.0, 390.0,"~n~~n~~n~~n~~n~~n~~n~~n~");
    TextDrawFont(textDraw[StripeDown],1);
    TextDrawLetterSize(textDraw[StripeDown],1,1);
    TextDrawColor(textDraw[StripeDown],0x000000FF);
    TextDrawSetShadow(textDraw[StripeDown],1);
    TextDrawSetOutline(textDraw[StripeDown],50);
    TextDrawBackgroundColor(textDraw[StripeDown],0x000000FF);
    TextDrawUseBox(textDraw[StripeDown],1);
    TextDrawBoxColor(textDraw[StripeDown],0x000000FF);
    
    textDraw[prepareTime] = TextDrawCreate(320.000000, 100.000000, " ");
    TextDrawAlignment(textDraw[prepareTime], 2);
    TextDrawBackgroundColor(textDraw[prepareTime], 255);
    TextDrawFont(textDraw[prepareTime], 2);
    TextDrawLetterSize(textDraw[prepareTime], 0.500000, 2.599998);
    TextDrawColor(textDraw[prepareTime], -1);
    TextDrawSetOutline(textDraw[prepareTime], 1);
    TextDrawSetProportional(textDraw[prepareTime], 1);
    
    textDraw[baseInfo] = TextDrawCreate(320.000000, 432.000000, " ");
    TextDrawAlignment(textDraw[baseInfo], 2);
    TextDrawBackgroundColor(textDraw[baseInfo], 255);
    TextDrawFont(textDraw[baseInfo], 3);
    TextDrawLetterSize(textDraw[baseInfo], 0.240000, 1.200000);
    TextDrawColor(textDraw[baseInfo], -1);
    TextDrawSetOutline(textDraw[baseInfo], 1);
    TextDrawSetProportional(textDraw[baseInfo], 1);
    TextDrawUseBox(textDraw[baseInfo], 1);
    TextDrawBoxColor(textDraw[baseInfo], 68);
    TextDrawTextSize(textDraw[baseInfo], 0.000000, 680.000000);
    
    textDraw[checkpointInfo] = TextDrawCreate(320.000000, 381.000000, " ");
    TextDrawAlignment(textDraw[checkpointInfo], 2);
    TextDrawBackgroundColor(textDraw[checkpointInfo], 255);
    TextDrawFont(textDraw[checkpointInfo], 1);
    TextDrawLetterSize(textDraw[checkpointInfo], 0.609999, 2.200000);
    TextDrawColor(textDraw[checkpointInfo], -1);
    TextDrawSetOutline(textDraw[checkpointInfo], 1);
    TextDrawSetProportional(textDraw[checkpointInfo], 1);
    TextDrawSetShadow(textDraw[checkpointInfo], 1);

    //Scoreboard
    textDraw[homePlayers] = TextDrawCreate(210.000000, 130.000000, "~w~DDDDDDDDDDDDDDDDDDDD (12)~n~DDSADSADASDAS (23)");
    TextDrawAlignment(textDraw[homePlayers], 2);
    TextDrawBackgroundColor(textDraw[homePlayers], 255);
    TextDrawFont(textDraw[homePlayers], 1);
    TextDrawLetterSize(textDraw[homePlayers], 0.310000, 1.300000);
    TextDrawColor(textDraw[homePlayers], -1);
    TextDrawSetOutline(textDraw[homePlayers], 1);
    TextDrawSetProportional(textDraw[homePlayers], 1);
    TextDrawUseBox(textDraw[homePlayers], 1);
    TextDrawBoxColor(textDraw[homePlayers], 68);
    TextDrawTextSize(textDraw[homePlayers], 0.000000, 178.000000);

    textDraw[awayPlayers] = TextDrawCreate(402.000000, 130.000000, "~w~DDDDDDDDDDDDDDDDDDDD (12)~n~DDSADSADASDAS (23)");
    TextDrawAlignment(textDraw[awayPlayers], 2);
    TextDrawBackgroundColor(textDraw[awayPlayers], 255);
    TextDrawFont(textDraw[awayPlayers], 1);
    TextDrawLetterSize(textDraw[awayPlayers], 0.310000, 1.300000);
    TextDrawColor(textDraw[awayPlayers], -1);
    TextDrawSetOutline(textDraw[awayPlayers], 1);
    TextDrawSetProportional(textDraw[awayPlayers], 1);
    TextDrawUseBox(textDraw[awayPlayers], 1);
    TextDrawBoxColor(textDraw[awayPlayers], 68);
    TextDrawTextSize(textDraw[awayPlayers], 0.000000, 178.000000);

    textDraw[scoreboard_Home] = TextDrawCreate(213.000000, 111.000000, "~p~~h~(UvH) - Attacking");
    TextDrawAlignment(textDraw[scoreboard_Home], 2);
    TextDrawBackgroundColor(textDraw[scoreboard_Home], 255);
    TextDrawFont(textDraw[scoreboard_Home], 1);
    TextDrawLetterSize(textDraw[scoreboard_Home], 0.400000, 1.600000);
    TextDrawColor(textDraw[scoreboard_Home], -1);
    TextDrawSetOutline(textDraw[scoreboard_Home], 1);
    TextDrawSetProportional(textDraw[scoreboard_Home], 1);

    textDraw[scoreboard_Away] = TextDrawCreate(405.000000, 111.000000, "~g~~h~Away - Defending");
    TextDrawAlignment(textDraw[scoreboard_Away], 2);
    TextDrawBackgroundColor(textDraw[scoreboard_Away], 255);
    TextDrawFont(textDraw[scoreboard_Away], 1);
    TextDrawLetterSize(textDraw[scoreboard_Away], 0.400000, 1.600000);
    TextDrawColor(textDraw[scoreboard_Away], -1);
    TextDrawSetOutline(textDraw[scoreboard_Away], 1);
    TextDrawSetProportional(textDraw[scoreboard_Away], 1);

    textDraw[statDes] = TextDrawCreate(310.000000, 98.000000, "Base: #23    /     Winner: UvH    /    MVP: SSSSSSSSSSSSSSSSSSSS (12)");
    TextDrawAlignment(textDraw[statDes], 2);
    TextDrawBackgroundColor(textDraw[statDes], 255);
    TextDrawFont(textDraw[statDes], 1);
    TextDrawLetterSize(textDraw[statDes], 0.240000, 1.300000);
    TextDrawColor(textDraw[statDes], -1);
    TextDrawSetOutline(textDraw[statDes], 1);
    TextDrawSetProportional(textDraw[statDes], 1);
    
    textDraw[baseTime] = TextDrawCreate(320.000000, 430.000000, "Initializing...");
    TextDrawAlignment(textDraw[baseTime], 2);
    TextDrawBackgroundColor(textDraw[baseTime], 255);
    TextDrawFont(textDraw[baseTime], 3);
    TextDrawLetterSize(textDraw[baseTime], 0.340000, 1.499999);
    //TextDrawColor(textDraw[baseTime], -1);
    TextDrawColor(textDraw[baseTime], 0x670096FF);
    TextDrawSetOutline(textDraw[baseTime], 1);
    TextDrawSetProportional(textDraw[baseTime], 1);
    
    format(szDrawString, 256, "%s~h~Attacking", ATT_TAG);
    textDraw[baseRole_Att] = TextDrawCreate(556.000000, 136.000000, szDrawString);
    TextDrawAlignment(textDraw[baseRole_Att], 2);
    TextDrawBackgroundColor(textDraw[baseRole_Att], 255);
    TextDrawFont(textDraw[baseRole_Att], 1);
    TextDrawLetterSize(textDraw[baseRole_Att], 0.729999, 3.399998);
    TextDrawColor(textDraw[baseRole_Att], -1);
    TextDrawSetOutline(textDraw[baseRole_Att], 1);
    TextDrawSetProportional(textDraw[baseRole_Att], 1);

    textDraw[baseRoleback] = TextDrawCreate(633.000000, 141.000000, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~");
    TextDrawBackgroundColor(textDraw[baseRoleback], 255);
    TextDrawFont(textDraw[baseRoleback], 1);
    TextDrawLetterSize(textDraw[baseRoleback], 0.500000, 1.000000);
    TextDrawColor(textDraw[baseRoleback], -1);
    TextDrawSetOutline(textDraw[baseRoleback], 0);
    TextDrawSetProportional(textDraw[baseRoleback], 1);
    TextDrawSetShadow(textDraw[baseRoleback], 1);
    TextDrawUseBox(textDraw[baseRoleback], 1);
    TextDrawBoxColor(textDraw[baseRoleback], 51);
    TextDrawTextSize(textDraw[baseRoleback], 480.000000, 421.000000);

    textDraw[baseRoleDes_Att] = TextDrawCreate(487.000000, 173.000000, "You have to take ~n~over the enemy base~n~or to kill all~n~defenders.~n~~r~~b~Use /v to spawn a~n~vehicle.");
    TextDrawBackgroundColor(textDraw[baseRoleDes_Att], 255);
    TextDrawFont(textDraw[baseRoleDes_Att], 3);
    TextDrawLetterSize(textDraw[baseRoleDes_Att], 0.360000, 1.300000);
    TextDrawColor(textDraw[baseRoleDes_Att], -1);
    TextDrawSetOutline(textDraw[baseRoleDes_Att], 1);
    TextDrawSetProportional(textDraw[baseRoleDes_Att], 1);
    
    format(szDrawString, 256, "%s~h~Defending", DEF_TAG);
    textDraw[baseRole_Def] = TextDrawCreate(556.000000, 136.000000, szDrawString);
    TextDrawAlignment(textDraw[baseRole_Def], 2);
    TextDrawBackgroundColor(textDraw[baseRole_Def], 255);
    TextDrawFont(textDraw[baseRole_Def], 1);
    TextDrawLetterSize(textDraw[baseRole_Def], 0.729999, 3.399998);
    TextDrawColor(textDraw[baseRole_Def], -1);
    TextDrawSetOutline(textDraw[baseRole_Def], 1);
    TextDrawSetProportional(textDraw[baseRole_Def], 1);
    
    textDraw[baseRoleDes_Def] = TextDrawCreate(487.000000, 173.000000, "You have to defend ~n~the base and to kill~n~all intruding~n~attackers.");
    TextDrawBackgroundColor(textDraw[baseRoleDes_Def], 255);
    TextDrawFont(textDraw[baseRoleDes_Def], 3);
    TextDrawLetterSize(textDraw[baseRoleDes_Def], 0.360000, 1.300000);
    TextDrawColor(textDraw[baseRoleDes_Def], -1);
    TextDrawSetOutline(textDraw[baseRoleDes_Def], 1);
    TextDrawSetProportional(textDraw[baseRoleDes_Def], 1);
    /*
    textDraw[teamInfo] = TextDrawCreate(50.000000, 325.000000,  " ");
    TextDrawBackgroundColor(textDraw[teamInfo], 255);
    TextDrawFont(textDraw[teamInfo], 3);
    TextDrawLetterSize(textDraw[teamInfo], 0.380000, 1.200000);
    TextDrawColor(textDraw[teamInfo], -1);
    TextDrawSetOutline(textDraw[teamInfo], 1);
    TextDrawSetProportional(textDraw[teamInfo], 1);
    
    textDraw[teamScores] = TextDrawCreate(552.000000, 100.000000, " ");
    TextDrawAlignment(textDraw[teamScores], 2);
    TextDrawBackgroundColor(textDraw[teamScores], 255);
    TextDrawFont(textDraw[teamScores], 3);
    TextDrawLetterSize(textDraw[teamScores], 0.409999, 1.799999);
    TextDrawColor(textDraw[teamScores], -1);
    TextDrawSetOutline(textDraw[teamScores], 1);
    TextDrawSetProportional(textDraw[teamScores], 1);
    */
    
    textDraw[teamScores] = TextDrawCreate(5.000000, 432.000000, "~w~Scores: ~b~~h~UvH ~w~23 ~r~- ~w~42 ~b~~h~uGp");
    TextDrawBackgroundColor(textDraw[teamScores], 255);
    TextDrawFont(textDraw[teamScores], 2);
    TextDrawLetterSize(textDraw[teamScores], 0.200000, 1.400000);
    TextDrawColor(textDraw[teamScores], -1);
    TextDrawSetOutline(textDraw[teamScores], 1);
    TextDrawSetProportional(textDraw[teamScores], 1);

    textDraw[teamInfo] = TextDrawCreate(5.000000, 420.000000, "~w~Teams: ~b~~h~12~w~/~r~~h~10");
    TextDrawBackgroundColor(textDraw[teamInfo], 255);
    TextDrawFont(textDraw[teamInfo], 2);
    TextDrawLetterSize(textDraw[teamInfo], 0.200000, 1.400000);
    TextDrawColor(textDraw[teamInfo], -1);
    TextDrawSetOutline(textDraw[teamInfo], 1);
    TextDrawSetProportional(textDraw[teamInfo], 1);
    
    textDraw[firstBlood] = TextDrawCreate(320.000000, 240.000000, "FIRST BLOOD~n~~n~~y~(UvH)THIAZ");
    TextDrawAlignment(textDraw[firstBlood], 2);
    TextDrawBackgroundColor(textDraw[firstBlood], 255);
    TextDrawFont(textDraw[firstBlood], 2);
    TextDrawLetterSize(textDraw[firstBlood], 0.500000, 2.900000);
    TextDrawColor(textDraw[firstBlood], -16776961);
    TextDrawSetOutline(textDraw[firstBlood], 1);
    TextDrawSetProportional(textDraw[firstBlood], 1);

    textDraw[redScreen] = TextDrawCreate(-5.000000, -9.000000, "~n~");
    TextDrawBackgroundColor(textDraw[redScreen], 255);
    TextDrawFont(textDraw[redScreen], 1);
    TextDrawLetterSize(textDraw[redScreen], 1.580000, 50.599990);
    TextDrawColor(textDraw[redScreen], -1);
    TextDrawSetOutline(textDraw[redScreen], 0);
    TextDrawSetProportional(textDraw[redScreen], 1);
    TextDrawSetShadow(textDraw[redScreen], 1);
    TextDrawUseBox(textDraw[redScreen], 1);
    TextDrawBoxColor(textDraw[redScreen], -16777165);
    TextDrawTextSize(textDraw[redScreen], 797.000000, 156.000000);
    
    textDraw[barDes][TEAM_HOME] = TextDrawCreate(555.000000, 395.000000, "~r~~h~UvH~w~:");
    TextDrawAlignment(textDraw[barDes][TEAM_HOME], 3);
    TextDrawBackgroundColor(textDraw[barDes][TEAM_HOME], 255);
    TextDrawFont(textDraw[barDes][TEAM_HOME], 3);
    TextDrawLetterSize(textDraw[barDes][TEAM_HOME], 0.349999, 1.000000);
    TextDrawColor(textDraw[barDes][TEAM_HOME], -1);
    TextDrawSetOutline(textDraw[barDes][TEAM_HOME], 1);
    TextDrawSetProportional(textDraw[barDes][TEAM_HOME], 1);
    
    textDraw[barDes][TEAM_AWAY] = TextDrawCreate(555.000000, 415.000000, "~b~~h~eF~w~:");
    TextDrawAlignment(textDraw[barDes][TEAM_AWAY], 3);
    TextDrawBackgroundColor(textDraw[barDes][TEAM_AWAY], 255);
    TextDrawFont(textDraw[barDes][TEAM_AWAY], 3);
    TextDrawLetterSize(textDraw[barDes][TEAM_AWAY], 0.349999, 1.000000);
    TextDrawColor(textDraw[barDes][TEAM_AWAY], -1);
    TextDrawSetOutline(textDraw[barDes][TEAM_AWAY], 1);
    TextDrawSetProportional(textDraw[barDes][TEAM_AWAY], 1);
    
    textDraw[healLost][TEAM_HOME] = TextDrawCreate(164.000000, 412.000000, " ");
    TextDrawAlignment(textDraw[healLost][TEAM_HOME], 2);
    TextDrawBackgroundColor(textDraw[healLost][TEAM_HOME], 255);
    TextDrawFont(textDraw[healLost][TEAM_HOME], 2);
    TextDrawLetterSize(textDraw[healLost][TEAM_HOME], 0.529999, 1.600000);
    TextDrawColor(textDraw[healLost][TEAM_HOME], -16776961);
    TextDrawSetOutline(textDraw[healLost][TEAM_HOME], 1);
    TextDrawSetProportional(textDraw[healLost][TEAM_HOME], 1);

    textDraw[healLost][TEAM_AWAY] = TextDrawCreate(470.000000, 412.000000, " ");
    TextDrawAlignment(textDraw[healLost][TEAM_AWAY], 2);
    TextDrawBackgroundColor(textDraw[healLost][TEAM_AWAY], 255);
    TextDrawFont(textDraw[healLost][TEAM_AWAY], 2);
    TextDrawLetterSize(textDraw[healLost][TEAM_AWAY], 0.529999, 1.600000);
    TextDrawColor(textDraw[healLost][TEAM_AWAY], -16776961);
    TextDrawSetOutline(textDraw[healLost][TEAM_AWAY], 1);
    TextDrawSetProportional(textDraw[healLost][TEAM_AWAY], 1);
    
    textDraw[healthBar][TEAM_HOME] = CreateProgressBar(558.00, 395.00, 75.50, 8.20, 65535, 100.0); //def
    textDraw[healthBar][TEAM_AWAY] = CreateProgressBar(558.00, 415.00, 75.50, 8.20, -16776961, 100.0); //att
    return true;
}

stock getTeamPlayers(_iTeam)
{
    new i;
    
    loop_players(playerId)
    {
        if (playerData[playerId][team] == _iTeam)
        {
            i++;
        }
    }
    
    return i;
}

stock isNumeric(const string[]) 
{
    new length=strlen(string);
    if (length==0) return false;
    for (new i = 0; i < length; i++) 
    {
        if (
        (string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+')
        || (string[i]=='-' && i!=0)                                             
        || (string[i]=='+' && i!=0)                                             
       ) return false;
    }
    if (length==1 && (string[0]=='-' || string[0]=='+')) return false;
    return true;
}

stock isValidWeapon(weaponid) 
{
    if (weaponid == 19 || weaponid == 20 || weaponid == 21 || weaponid < 0 || weaponid > 38) return false;
    return true;
}

stock bool:isValidVehicle(vehid) 
{
    if (vehid >= 400 && vehid <= 611 && vehid != 520 && vehid != 425 && vehid != 447 && vehid != 432 && vehid != 407) 
    {
        return true;
    }
    
    return false;
}

stock getWeaponSlot(iWeaponID) 
{
    switch(iWeaponID) 
    {
        case 0, 1: return 0;
        case 2, 3, 4, 5, 6, 7, 8, 9: return 1;
        case 10, 11, 12, 13, 14, 15: return 10;
        case 16, 17, 18, 39: return 8;
        case 22, 23, 24: return 2;
        case 25, 26, 27: return 3;
        case 28, 29, 32: return 4;
        case 30, 31: return 5;
        case 33, 34: return 6;
        case 35..38: return 7;
        case 40: return 12;
        case 41..43: return 9;
    }
    
    return -1;
}

stock getWeaponNameEx(weaponid) 
{
    new s_Out[32];
    switch(weaponid) 
    {
        case 0: s_Out = "Fists";
        case 1: s_Out = "Brass Knuckles";
        case 2: s_Out = "Golf Club";
        case 3: s_Out = "Nite Stick";
        case 4: s_Out = "Knife";
        case 5: s_Out = "Baseball Bat";
        case 6: s_Out = "Shovel";
        case 7: s_Out = "Pool Cue";
        case 8: s_Out = "Katana";
        case 9: s_Out = "Chainsaw";
        case 10: s_Out = "Dildo";
        case 11: s_Out = "Dildo";
        case 12: s_Out = "Dildo";
        case 13: s_Out = "Dildo";
        case 14: s_Out = "Flowers";
        case 15: s_Out = "Cane";
        case 16: s_Out = "Grenade";
        case 17: s_Out = "Tear Gas";
        case 18: s_Out = "Molotov";
        case 22: s_Out = "9mm";
        case 23: s_Out = "Silenced 9mm";
        case 24: s_Out = "Desert Eagle";
        case 25: s_Out = "Shotgun";
        case 26: s_Out = "Sawnoff";
        case 27: s_Out = "Spas12";
        case 28: s_Out = "Uzi";
        case 29: s_Out = "MP5";
        case 30: s_Out = "AK47";
        case 31: s_Out = "M4";
        case 32: s_Out = "Tec9";
        case 33: s_Out = "Country Rifle";
        case 34: s_Out = "Sniper";
        case 35: s_Out = "Rocketlauncher";
        case 36: s_Out = "Rocketlauncher";
        case 37: s_Out = "Flamethrower";
        case 38: s_Out = "Minigun";
        case 41: s_Out = "Spraycan";
        case 51: s_Out = "Explosion";
        default: s_Out = "Unknown";
    }

    return s_Out;
}

stock clearDeathMessages() 
{
    new a;
    for(new i; i < 5; i++)
    {
        SendDeathMessage(MAX_PLAYERS, MAX_PLAYERS, a);
    }
}

stock getDateTime() 
{
    new iDay,
        iMonth,
        iYear,
        iSecond,
        iMinute,
        iHour,
        sText[128];
        
    gettime(iHour, iMinute, iSecond);
    getdate(iYear, iMonth, iDay);
    format(sText, 128, "%02d.%02d.%d - %02d:%02d:%02d", iDay, iMonth, iYear, iHour, iMinute, iSecond);
    return sText;
}

stock fTime(iSeconds) 
{
    new iMins, 
        iSecs = iSeconds,
        szOut[8];
        
    while(iSecs >= 60)
    {
        iMins++;
        iSecs -= 60;
    }
    
    format(szOut, 8, "%02d:%02d", iMins, iSecs);
    return szOut;
}

stock Float: getDiv(iInput, iInput2) 
{
    new Float: fOut;
    if (iInput2 > 0) 
    {
        fOut = floatdiv(iInput, iInput2);
    }
    
    else 
    {
        fOut = float(iInput); 
    }
    
    return Float: fOut;
}

stock getTeamWithLessPlayers()
{
    new aTeams[2],
        nPlayerTeam;
        
    loop_players(playerId)
    {
        nPlayerTeam = playerData[playerId][team];
        
        if (nPlayerTeam == TEAM_HOME)
            aTeams[TEAM_HOME]++;
        
        else if (nPlayerTeam == TEAM_AWAY)
            aTeams[TEAM_AWAY]++;
            
    }
    
    return (aTeams[TEAM_AWAY] <= aTeams[TEAM_HOME]) ? (TEAM_AWAY) : (TEAM_HOME);
}

stock homeAttacking()
    return teamData[TEAM_HOME][bAttacking];

stock isCar(vehicleid) 
{
    switch(vehicleid) {
        case 443: return false;
        case 448: return false;
        case 461: return false;
        case 462: return false;
        case 463: return false;
        case 468: return false;
        case 521: return false;
        case 522: return false;
        case 523: return false;
        case 581: return false;
        case 586: return false;
        case 481: return false;
        case 509: return false;
        case 510: return false;
        case 430: return false;
        case 446: return false;
        case 452: return false;
        case 453: return false;
        case 454: return false;
        case 472: return false;
        case 473: return false;
        case 484: return false;
        case 493: return false;
        case 595: return false;
        case 417: return false;
        case 425: return false;
        case 447: return false;
        case 465: return false;
        case 469: return false;
        case 487: return false;
        case 488: return false;
        case 497: return false;
        case 501: return false;
        case 548: return false;
        case 563: return false;
        case 406: return false;
        case 444: return false;
        case 556: return false;
        case 557: return false;
        case 573: return false;
        case 460: return false;
        case 464: return false;
        case 476: return false;
        case 511: return false;
        case 512: return false;
        case 513: return false;
        case 519: return false;
        case 520: return false;
        case 539: return false;
        case 553: return false;
        case 577: return false;
        case 592: return false;
        case 593: return false;
        case 471: return false;
    }
    
    return true;
}
    
stock Float: betweenPoints(Float: x1, Float: y1, Float: z1, Float: x2, Float: y2, Float: z2) 
{
    return floatadd(floatadd(floatsqroot(floatpower(floatsub(x1, x2), 2)), floatsqroot(floatpower(floatsub(y1, y2), 2))),floatsqroot(floatpower(floatsub(z1, z2), 2)));
}

stock rampageSound() 
{
    loop_players(playerId) 
    {
        PlayerPlaySound(playerId, 1183, 0.0, 0.0, 0.0);
    }
    
    SetTimer("alias_disableRampageSound", 5800, false);
    return true;
}

forward alias_disableRampageSound();
public alias_disableRampageSound() { disableRampageSound(); }

stock disableRampageSound() 
{
    loop_players(playerId) 
    {
        PlayerPlaySound(playerId, 1184, 0.0, 0.0, 0.0);
    }
    
    return true;
}

forward checkHealthLost();
public checkHealthLost() {
    loop_players(playerId) {
        if (playerData[playerId][lastDamage] >= 3000 && playerData[playerId][lastDamage] != 0) {
            playerData[playerId][recentDamage] = 0;
            playerData[playerId][hitsReceived] = 0;
            playerData[playerId][lastDamage] = 0;
            TextDrawSetString(textDraw[hpLost][playerId], " ");
            
            if (playerData[playerId][healthObject] != INVALID_OBJECT_ID)
                DestroyObject(playerData[playerId][healthObject]);
                
            if (playerData[playerId][armourObject] != INVALID_OBJECT_ID)
                DestroyObject(playerData[playerId][armourObject]);
        }
    }
    
    for (new i = 0; i < 2; i++) {
        if (teamData[i][lastHealthLost] >= 3000 && teamData[i][lastHealthLost] != 0) {
            teamData[i][lastHealthLost] = 0;
            teamData[i][damageGot] = 0;
            
            TextDrawSetString(textDraw[healLost][i], " ");
        }
    }
}

forward TogglePlayerControllableEx(playerId, bool:toggle);
public TogglePlayerControllableEx(playerId, bool:toggle) 
{
    TogglePlayerControllable(playerId, toggle);
    return true;
}

stock AdminMessage(sMessage[]) 
{
    loop_players(i) 
    {
        if(playerData[i][level] >= LEVEL_MOD) 
        {
            SendFormattedMessage(i, C_YELLOW, "* ADMIN: %s", sMessage);
        }
    }
    
    return true;
}

stock TeamMessage(itTeam, sMessage[]) 
{
    loop_players(i) 
    {
        if(playerData[i][team] == itTeam) 
        {
            SendFormattedMessage(i, C_CYAN, "TEAM: %s", sMessage);
        }
    }
    
    return true;
}

forward PlayerTextDrawUpdate();
public PlayerTextDrawUpdate() 
{
    new szModeNames[64];
    format(szModeNames, 64, "~w~Scores: ~b~~h~%s ~w~%d ~r~~h~- ~w~%d ~b~~h~%s", gameConfig[homeName], teamData[TEAM_HOME][iTeamScore], teamData[TEAM_AWAY][iTeamScore], gameConfig[awayName]);
    TextDrawSetString(textDraw[teamScores], szModeNames);
    
    loop_players(playerId) 
    {
        new Float:fTempHealth,
            Float:fTempArmour;
        
        GetPlayerHealth(playerId, fTempHealth);
        GetPlayerArmour(playerId, fTempArmour);
            
        if(playerData[playerId][isPlaying] == true) {
            SetPlayerScore(playerId, floatround((fTempHealth + fTempArmour)));
            ResetPlayerMoney(playerId);
            GivePlayerMoney(playerId, - floatround((fTempHealth + fTempArmour)));
        }
        
        else {
            SetPlayerScore(playerId, playerData[playerId][kills]);
            
            ResetPlayerMoney(playerId);
            GivePlayerMoney(playerId, - playerData[playerId][kills]);
        }
    }
    return true;
}
    
forward SendMOTD();
public SendMOTD() 
{
    SendClientMessageToAll(C_ORANGE, "=======================");
    SendFormattedMessageToAll(C_ORANGE, "* You are playing on Ultra Violent A/D - Hosted by %s.", CLAN_NAME);
    SendFormattedMessageToAll(C_ORANGE, "* Visit us at %s! - Check out /credits", CLAN_PAGE);
    SendClientMessageToAll(C_ORANGE, "=======================");
}

forward DestroyObjectEx(objectid);
public DestroyObjectEx(objectid) 
{
    DestroyObject(objectid);
    return true;
}

stock TriggerCPCount(playerId) {
    if(IsPlayerInCheckpoint(playerId) && gameData[bActiveCP] == false) {
        KillTimer(gameData[iCPTimerID]);
        gameData[iCPCount] = gameConfig[iCPCount];
        UpdateCPCount(true);
        
        gameData[bActiveCP] = true;
        gameData[iActiveCPID] = playerId;
    }
    
    return true;
}

stock DeTriggerCPCount() {
    gameData[iCPCount] = gameConfig[iCPCount];
    gameData[bActiveCP] = false;
    gameData[iActiveCPID] = INVALID_PLAYER_ID;
    TextDrawHideForAll(textDraw[checkpointInfo]);
    KillTimer(gameData[iCPTimerID]);
    return true;
}
        
forward UpdateCPCount(bool:bFirst);
public UpdateCPCount(bool:bFirst) {
    new szTextDrawUpdate[32];
    
    gameData[iCPCount]--;
    if(gameData[iCPCount] > 10) 
        format(szTextDrawUpdate, 32, "~b~~h~Checkpoint: ~g~~h~%d", gameData[iCPCount]);
        
    if(gameData[iCPCount] <= 10 && gameData[iCPCount] > 5) 
        format(szTextDrawUpdate, 32, "~b~~h~Checkpoint: ~y~~h~%d", gameData[iCPCount]);
    
    if(gameData[iCPCount] <= 5)
        format(szTextDrawUpdate, 32, "~b~~h~Checkpoint: ~r~~h~%d", gameData[iCPCount]);
        
    TextDrawSetString(textDraw[checkpointInfo], szTextDrawUpdate);
    PlaySound(1147);
    
    if(bFirst == true) 
    {
        loop_players(playerId) {
            if(playerData[playerId][isPlaying] == true) {
                TextDrawShowForPlayer(playerId, textDraw[checkpointInfo]);
            }
        }
        
        gameData[iCPTimerID] = SetTimerEx("UpdateCPCount", 1000, 0, "b", false);
        return true;
    }
    
    if(gameData[iCPCount] > 0 && IsPlayerInCheckpoint(gameData[iActiveCPID]) && gameData[bActiveCP] == true) {
        gameData[iCPTimerID] = SetTimerEx("UpdateCPCount", 1000, 0, "b", false);
    }
    
    else if(gameData[iCPCount] == 0) {
        CBase::EndBase(CASE_ATTWIN);
        TextDrawHideForAll(textDraw[checkpointInfo]);
    }
    
    else if(!IsPlayerInCheckpoint(gameData[iActiveCPID]) || gameData[bActiveCP] == false) 
        DeTriggerCPCount();
    
    return true;
}

stock PlaySound(soundid) {
    new Float:X,
        Float:Y,
        Float:Z;
        
    loop_players(playerId) {
        GetPlayerPos(playerId, X, Y, Z);
        PlayerPlaySound(playerId, soundid, X, Y, Z);
    }
    
    return true;
}

stock HidePlayersFromOtherPlayers() {
    loop_players(i) {
        loop_players(l) {
            if((playerData[i][team] != playerData[l][team]) && playerData[i][isPlaying] == true && playerData[l][isPlaying] == true && i != l) {
                SetPlayerMarkerForPlayer(i, l, (GetPlayerColor(l) & 0xFFFFFF00));
                SetPlayerMarkerForPlayer(l, i, (GetPlayerColor(i) & 0xFFFFFF00));
            }
            
            else if((playerData[i][team] == playerData[l][team]) && playerData[i][isPlaying] == true && playerData[l][isPlaying] == true && i != l) {
                SetPlayerMarkerForPlayer(i, l, (GetPlayerColor(l) | 0x000000FF));
                SetPlayerMarkerForPlayer(l, i, (GetPlayerColor(i) | 0x000000FF));
            }
        }
        
        if(playerData[i][isPlaying] == true) 
            SetPlayerTeam(i, playerData[i][team]);
        
        else
            SetPlayerTeam(i, NO_TEAM);
    }
    
    if(gameData[bIsRoundActive] == true) {
        SetTimer("HidePlayersFromOtherPlayers", 500, 0);
        return true;
    }
    
    else {
        loop_players(playerId) 
            SetPlayerTeam(playerId, NO_TEAM);
        
        UnhidePlayers();
        return true;
    }
}

stock UnhidePlayers() {
    loop_players(i) 
    {
        loop_players(l) 
        {
            SetPlayerMarkerForPlayer(i, l, (GetPlayerColor(l) | 0x000000FF));
            SetPlayerMarkerForPlayer(l, i, (GetPlayerColor(i) | 0x000000FF));
            
            ShowPlayerNameTagForPlayer(i, l, true);
            ShowPlayerNameTagForPlayer(l, i, true);
        }
    }
    
    return true;
}

forward DisableWeaponChoosing();
public DisableWeaponChoosing() {
    gameData[bWeaponChoose] = false;
    return true;
}

forward UpdateVehicleHealth();
public UpdateVehicleHealth() {
    loop_vehicles(vehicleid) {
        if(GetVehicleVirtualWorld(vehicleid) == BASE_WORLD) {
            new Float:fVHealth;
            
            GetVehicleHealth(vehicleid, fVHealth);
            
            if(fVHealth == 1000.0) 
            {
                Update3DTextLabelText(vehicleData[vehicleid][VehicleHealth], C_RED, "||||||||||");
            }
            
            if(fVHealth < 1000.0 && fVHealth > 900.0) 
            {
                Update3DTextLabelText(vehicleData[vehicleid][VehicleHealth], C_RED, "|||||||||{777777}|");
            }
            
            else if(fVHealth <= 900.0 && fVHealth > 800.0) 
            {
                Update3DTextLabelText(vehicleData[vehicleid][VehicleHealth], C_RED, "||||||||{777777}||");
            }
            
            else if(fVHealth <= 800.0 && fVHealth > 700.0) 
            {
                Update3DTextLabelText(vehicleData[vehicleid][VehicleHealth], C_RED, "|||||||{777777}|||");
            }
            
            else if(fVHealth <= 700.0 && fVHealth > 600.0)
            {
                Update3DTextLabelText(vehicleData[vehicleid][VehicleHealth], C_RED, "||||||{777777}||||");
            }
            
            else if(fVHealth <= 600.0 && fVHealth > 500.0) 
            {
                Update3DTextLabelText(vehicleData[vehicleid][VehicleHealth], C_RED, "|||||{777777}|||||");
            }
            
            else if(fVHealth <= 500.0 && fVHealth > 400.0) 
            {
                Update3DTextLabelText(vehicleData[vehicleid][VehicleHealth], C_RED, "||||{777777}||||||");
            }
            
            else if(fVHealth <= 400.0 && fVHealth > 300.0) 
            {
                Update3DTextLabelText(vehicleData[vehicleid][VehicleHealth], C_RED, "|||{777777}|||||||");
            }
            
            else if(fVHealth <= 300.0 && fVHealth > 200.0) 
            {
                Update3DTextLabelText(vehicleData[vehicleid][VehicleHealth], C_RED, "||{777777}||||||||");
            }
            
            else if(fVHealth <= 200.0 && fVHealth > 100.0) 
            {
                Update3DTextLabelText(vehicleData[vehicleid][VehicleHealth], C_RED, "|{777777}|||||||||");
            }
            
            else if(fVHealth <= 100.0 && fVHealth > 0.0) 
            {
                Update3DTextLabelText(vehicleData[vehicleid][VehicleHealth], C_RED, "{777777}||||||||||");
            }
        }
    }
    
    return true;
}

forward UpdateTeamTextDraw();
public UpdateTeamTextDraw() {
    new szTextDrawString[32],
        iA,
        iH;
    
    loop_players(playerId) 
    {
        switch(playerData[playerId][team]) 
        {
            case TEAM_HOME: iH++;
            case TEAM_AWAY: iA++;
        }
    }

    if(teamData[TEAM_HOME][bAttacking] == true) 
    {
        format(szTextDrawString, 32, "~w~Teams: %s~h~%d~w~/%s~h~%d", ATT_TAG, iH, DEF_TAG, iA);
    }
    
    if(teamData[TEAM_AWAY][bAttacking] == true)
    {
        format(szTextDrawString, 32, "~w~Teams: %s~h~%d~w~/%s~h~%d", DEF_TAG, iH, ATT_TAG, iA);
    }
   
    TextDrawSetString(textDraw[teamInfo], szTextDrawString);
    return true;
}

forward switchModeName(iTick);
public switchModeName(iTick) {
    new iNewTick,
        szModeName[64];
        
    switch (iTick) {
        case 0: {
            format(szModeName, 64, "%s %d - %d %s", gameConfig[homeName], teamData[TEAM_HOME][iTeamScore], teamData[TEAM_AWAY][iTeamScore], gameConfig[awayName]);
            iNewTick = 1;
        }
        
        case 1: {
            format(szModeName, 64, "UvAAD %s.%s.%s", MAJOR, MINOR, BUILD);
            iNewTick = 0;
        }
    }
    
    SetGameModeText(szModeName);
    SetTimerEx("switchModeName", 5000, 0, "d", iNewTick);
    return true;
}
    
    